﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Li.DingTalk.Model.Contacts
{
    /// <summary>
    /// 获取通讯录权限处理类
    /// </summary>

    public class authHD
    {
        /// <summary>
        /// 获取通讯录权限
        /// </summary>
        /// <param name="access_token"></param>
        /// <returns></returns>

        public static auth Getaddressjurisdiction(string access_token)
        {
            var path = string.Format("https://oapi.dingtalk.com/auth/scopes?access_token={0}", access_token);
            string resultJson = RequestHelper.Get(path);
            return Newtonsoft.Json.JsonConvert.DeserializeObject<auth>(resultJson);
        }
    }


    #region 通讯录权限信息
    /// <summary>
    /// 通讯录权限信息
    /// </summary>
    public class auth : ResultPackage
    {
        /// <summary>
        /// ISV可以直接使用企业的功能字段
        /// contact_call:isv是否可以电话联系企业管理员
        /// </summary>
        public string[] condition_field
        {
            get; set;
        }
        /// <summary>
        /// 可以得到的企业用户字段
        /// name:员工名称,email员工邮箱
        /// </summary>
        public string[] auth_user_field
        {
            get; set;
        }
        /// <summary>
        /// 企业授权
        /// </summary>
        public enterpriseauthorization auth_org_scopes
        {
            get;
            set;
        }
    }
    /// <summary>
    /// 企业授权
    /// </summary>
    public class enterpriseauthorization
    {
        /// <summary>
        /// 企业授权的部门id列表
        /// </summary>
        public int[] authed_dept
        {
            get; set;
        }
        /// <summary>
        /// 企业授权的员工userid列表
        /// </summary>
        public string[] authed_user
        {
            get; set;
        }
    }
    #endregion

}
